package com.example.www.Base;

import com.example.www.Entity.Photo;
import com.example.www.Entity.VideoCover;
import com.example.www.Entity.VideoLink;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;

import java.util.List;

@Data
public class Result<T> {

    @JsonProperty
    private T data;

    private int status;

    private String statusText;

    public Result(T data, int status, String statusText){
        this.data=data;
        this.status=status;
        this.statusText=statusText;
    }

    public static Result OK(){
        return new Result(null,200,"OK");
    }

    public static Result internalError(){
        return new Result<String>("Delete Failed",500, "Internal Server Error");
    }
    public static Result<String> authenticated(){
        return new Result<String>("Authenticated",200,"OK");
    }

    public static Result<String> token(String token){
        return new Result<String>(token,200,"OK");
    }

    public static Result<String> unAuthenticated(){
        return new Result<String>("UnAuthenticated",401,"Unauthorized");
    }

    public static Result<List<VideoCover>> videos(List<VideoCover> videoCovers){
        return new Result<List<VideoCover>>(videoCovers,200,"OK");
    }

    public static Result<VideoLink> video(VideoLink videoLink){
        return new Result<VideoLink>(videoLink,200,"OK");
    }

    public static Result<List<Photo>> photos(List<Photo> photos){
        return new Result<List<Photo>>(photos,200,"OK");
    }

    public static Result<Photo> photo(Photo photo){
        return new Result<Photo>(photo,200,"OK");
    }

    public static Result<Boolean> isUserExists(boolean userExists){
        return new Result<Boolean>(userExists,200,"OK");
    }
}
